package main

import (
	"flag"
	"fmt"
	"log"
	handler "my_doc_service/handler"
	"net/http"
)

var (
	port int    // 端口号
	path string // 静态文件露冷静
)

func init() {
	flag.IntVar(&port, "port", 11790, "服务监听的端口号")
	flag.StringVar(&path, "path", "public", "静态文件所在的路径")
}

func main() {
	flag.Parse()
	portStr := ":" + fmt.Sprint(port)
	myHandler := handler.MyHandler{path}
	err := http.ListenAndServe(portStr, myHandler)
	if err != nil {
		log.Println(err)
	}
}
